﻿<UserControl x:Class="Sample.StackOverflow.BadgesUserControl"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:c="clr-namespace:Sample.StackOverflow"
             Width="216">
    <UserControl.Resources>
        <Style TargetType="{x:Type TextBlock}">
            <Setter Property="VerticalAlignment" Value="Center" />
            <Setter Property="Margin" Value="5" />
        </Style>
        <Style TargetType="{x:Type Ellipse}">
            <Setter Property="Height" Value="24" />
            <Setter Property="Width" Value="24" />
            <Setter Property="Margin" Value="4,0" />
        </Style>
    </UserControl.Resources>
    <StackPanel Orientation="Horizontal">
        <StackPanel Orientation="Horizontal" Visibility="{Binding gold, Converter={c:NonZeroVisibilityConverter}}">
            <Ellipse 
                Fill="Gold" />
            <TextBlock
                Text="{Binding gold, FallbackValue=1000}" />
        </StackPanel>
        <StackPanel Orientation="Horizontal" Visibility="{Binding silver, Converter={c:NonZeroVisibilityConverter}}">
            <Ellipse 
                Fill="Silver" />
            <TextBlock
                Text="{Binding silver, FallbackValue=1000}" />
        </StackPanel>
        <StackPanel Orientation="Horizontal" Visibility="{Binding bronze, Converter={c:NonZeroVisibilityConverter}}">
            <Ellipse 
                Fill="Peru" />
            <TextBlock
                Text="{Binding bronze, FallbackValue=1000}" />
        </StackPanel>
    </StackPanel>
</UserControl>
